const env = process.env.RUNTIME_ENV;

let ip;

switch (env) {
  // 开发
  case 'dev':
    ip = 'http://82.156.217.14:7778';
    break;

  // 正式
  case 'prod':
    ip = 'http://82.156.217.14:7779';
    break;

  case 'loca':
    ip = 'http://192.168.20.37:7778';
    break;

  default:
    ip = 'http://82.156.217.14:8000';
}

console.log(`-- use proxy, env=${env}, ip=${ip}`);

module.exports = {
  host: 'localhost',
  port: 8080,
  proxy: {
    '/api': {
      target: ip,
      changeOrigin: true,
    },
  },
};
